package com.pay.manager.controller.system;




import com.pay.manager.dto.ChannelDTO;
import com.pay.manager.dto.OrderDTO;
import com.pay.manager.response.PageDataResult;

import com.pay.manager.service.OrderService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;


/**
 * @Title: OrderController
 * @Description: 订单管理
 * @author: yjw
 * @version: 1.0
 * @date: 2020/06/20 15:17
 */
@Controller
@RequestMapping("order")
public class OrderController {

	private Logger logger = LoggerFactory.getLogger(this.getClass());

	@Autowired
	private OrderService orderService;

	@RequestMapping("/orderManage")
	public String toPage() {
		logger.info("进入订单信息管理");
		return "/order/orderManage";
	}

	/**
	 *
	 * 功能描述: 分页查询用户列表
	 *
	 * @param:
	 * @return:
	 * @date: 2018/11/21 11:10
	 */
	@RequestMapping(value = "/getOrderList", method = RequestMethod.POST)
	@ResponseBody
	public PageDataResult getOrderList(@RequestParam("pageNum") Integer pageNum,
									   @RequestParam("pageSize") Integer pageSize, /* @Valid PageRequest page, */ OrderDTO orderSearch) {
		/*
		 * logger.info("分页查询用户列表！搜索条件：userSearch：" + userSearch + ",pageNum:" +
		 * page.getPageNum() + ",每页记录数量pageSize:" + page.getPageSize());
		 */

		PageDataResult pdr = new PageDataResult();
		try {
			if (null == pageNum) {
				pageNum = 1;
			}
			if (null == pageSize) {
				pageSize = 10;
			}
			// 获取用户列表
			pdr = orderService.getOrderList(orderSearch,pageNum,pageSize);
			logger.info("订单信息列表查询=pdr:" + pdr);

		} catch (Exception e) {
			e.printStackTrace();
			logger.error("订单信息列表查询异常！", e);
		}
		return pdr;
	}

}
